//<script language="Javascript">

<?
//////////////////  ASSETS  //////////////////
if($_set->wtype == "win") {
//////////////////////////////////////////////


//////////////// THE TWITTER EXPERIMENT
	if($_tool[1] == "interaction") {
	// tool : "social.interaction";
	
		if($_set->action == "tweet") {
	
		?>
			ref.seed([
				tag("font", {style:"font-size:18px"}, "Doe sociaal."), br,
				new Button({id:ref.id+".tweet", type:'social', action:'multitweet', descr:'update twitter', tool:'social.interaction', meta:{}}), br,
				new Button({id:ref.id+".fbevent", type:'social', action:'fbevent', descr:'create facebook events', tool:'social.interaction', meta:{}})
			]);
		
		<? }
	
	
	 exit(); }





/*///////////////  RSS CONTROLLER
	if($_tool[1] == "rss" && $_set->action == "edit.mod") {
		
		if($objects = $DB->parse("rss.ID, rss.title, tx.short, DATE_FORMAT(rss.pdate, '%d %b') as date", "mod_rss as rss, db_link as l, txtdump as tx", "l.ID=rss.feed AND tx.textid=l.nameid AND tx.lang='".LANG."' AND rss.status ORDER BY rss.pdate desc LIMIT 12", true) ) 
			foreach($objects as $k=>$obj) $objects[$k] = "{id:".$obj['ID'].", type:'rss', tool:'social.rss', name:\"".strlimit($obj['title'], 36)."\", list:[{ref:'name'},'".strlimit($obj['short'], 14)."','".$obj['date']."'], meta:{objtype:1}}";
			

		
	
	?>
		ref.seed([
			tag("font", {style:"font-size:18px"}, "Modify RSS object "), tag("a", {id:ref.id+".h1", href:"http://<?=engine_get('control.public')?>/?page=<?=$_set->vars->meta->page?>", target:"_blank"}, "(<?=$_set->vars->meta->page?>)"), br,
			tag("input", {id:ref.id+".name"}),
			tag("table", {id:ref.id+".list", cellpadding:"0", cellspacing:"0", class:"border", style:"width:94%;"}),
			tag("div", {id:ref.id+".feeds"}),
			tag("div", {id:ref.id+".extra"}),
			tag("div", {id:ref.id+".comment", class:"comment"})
		]);
		
		groups = { 
			feeds : [
				tag("table",{cellpadding:"0", cellspacing:"0"},[
					tag("tr",0,[
						tag("td",0,"feeds")
					])
				])
			],
			extra : [
				tag("table",{cellpadding:"0", cellspacing:"0"},[
					tag("tr",0,[
						tag("td",0,"extra")
					])
				])
		]};
		
		win.asset.group.build({id:ref.id+".feeds", descr:'RSS feeds', cont:groups.feeds, open:1 });
		win.asset.group.build({id:ref.id+".extra", descr:'Specificaties', cont:groups.extra, open:0 });
		
		[	{id:ref.id+".name", descr:'title', direct:1, textid:<?=$_set->vars->meta->modvars->nameid?>, values:<?=($_set->vars->meta->modvars->nameid)?json_encode($DB->parse_by(array("lang","short"),"txtdump","textid=".$_set->vars->meta->modvars->nameid, true)):"{}"?>}
		].each(function(obj){ win.asset.txtfield.build(obj); });
		
		[	{id:ref.id+".list", descr:'visible:', grid:3, values:[<?= implode(",",$objects); ?>]}].each(function(obj){ win.asset.list.build(obj); });
		
		
		
		<?
	}*/


}


//////////////////  "AJAX"  //////////////////
if($_set->wtype == "push") {
//////////////////////////////////////////////

	if($_tool[1] == "interaction") {
		
		
		if($_set->action == "multitweet") {
		
			$Social = $Engine->user_create_social( "TWITTER" );
			$Social->update_bulk();
			?>
			$( ref.trg ).value = "Twitter updated.";
			<?
		}
		
		elseif($_set->action == "tweet") {
			$Social = $Engine->user_create_social( "TWITTER" );
			$Social->tweet_object( $_set->vars->objid );
			$Social->update_bulk();
			?>

			$( ref.trg ).value = "Newspost will be tweeted.";
			<?			
		}
		
		elseif($_set->action == "fbevent") {
			$Social = $Engine->user_create_social( "FACEBOOK" );
			$Social->update_bulk();
			?>
			$( ref.trg ).value = "Facebook event created.";
			<?
		}

	}





}


/////////// LIST CONTROL

if($_set->action == "list") { ?>

	$(ref.trg).seed(<?= $_set->parse_list() ?>);
	
<? exit(); }

if( strstr( $_set->action, "flow") ) { ?>
	
	$('control_list')._push(ref.trg, <?= $_set->flow() ?> );

<? exit(); }



///////////////  GOOGLE MAPS  //////////////////
if($_modgroup[1]=="gmap"){
////////////////////////////////////////////////


?>	
	ref.seed([
        tag("font", {style:"font-size:18px"}, "<?=$_set->vars->input->descr;?> "), "\"<?=$_set->vars->input->name;?>\"", br,
        tag("div", {id:ref.id+".extra"}), "in development"
    ]);
	
<? }